<template>
  <div>
    <el-card>
      <el-table ref="tableName" :data="downloadList" height="500px" style="margin: 10px 0 10px" border :header-cell-style="{ background: '#FAFAFA' }">
        <el-table-column align="center" type="index"></el-table-column>
        <el-table-column align="center" label="编号" prop="parameterId" width="120px" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="牌号" prop="grade" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="测量条件文件名" prop="filename" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="下载时间" prop="time" show-overflow-tooltip></el-table-column>
      </el-table>
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="queryInfo.pagenum" :page-sizes="[10, 20]" :page-size="queryInfo.pagesize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
    </el-card>
  </div>
</template>

<script>
import { Message } from 'element-ui'
export default {
  data() {
    return {
      downloadList: [],
      queryInfo: {
        //当前的页数
        pageNum: 1,
        //当前每页显示多少条数据
        pageSize: 10
      },
      total: 0
    }
  },
  mounted() {
    this.loadData()
  },
  methods: {
    loadData() {
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: `/downloadHistory/getMyDownloadHistory?userId=${JSON.parse(window.localStorage.getItem('pro__Login_Userinfo')).value.id}&&pageSize=${this.queryInfo.pageSize}&&pageNo=${this.queryInfo.pageNum}`,
        method: 'POST'
      }).then(res => {
        console.log('resresss', res)
        this.downloadList = res.data.result.list.records
        this.total = res.data.result.list.total
      })
    },
    //页码改变
    handleSizeChange(newSize) {
      this.queryInfo.pageSize = newSize
      this.loadData()
    },
    handleCurrentChange(newPage) {
      this.queryInfo.pageNum = newPage
      this.loadData()
    }
  }
}
</script>

<style></style>
